home *** CD-ROM | disk | FTP | other *** search
- (*----------------------------------------------------------------------*)
- (* Send_Function_Key --- Send function key definition *)
- (*----------------------------------------------------------------------*)
-
- PROCEDURE Send_Function_Key( Key_Text : AnyStr ) ;
-
- (*----------------------------------------------------------------------*)
- (* *)
- (* Procedure: Send_Function_Key *)
- (* *)
- (* Purpose: Send function key definition *)
- (* *)
- (* Calling Sequence: *)
- (* *)
- (* Send_Function_Key( Key_Text : AnyStr ); *)
- (* *)
- (* Key_Text --- text to be sent *)
- (* *)
- (* Remarks: *)
- (* *)
- (* If the string to be sent has not "Wait For" markers, then *)
- (* it is sent in its entirety in one call here. If there ARE *)
- (* "Wait For" characters, then the flag WaitString_Mode is set *)
- (* TRUE, Script_Wait_Text is set to the character to be found, *)
- (* and Script_Wait_Reply_Text is set to the remainder of the *)
- (* function key string. This allows the terminal emulation to *)
- (* properly process any received characters while PibTerm is *)
- (* waiting for the selected string to appear. *)
- (* *)
- (*----------------------------------------------------------------------*)
-
- VAR
- I : INTEGER;
- L : INTEGER;
- Ch : CHAR;
- FK_Char : CHAR;
- Done : BOOLEAN;
-
- BEGIN (* Send_Function_Key *)
-
- L := LENGTH( Key_Text );
- I := 1;
- Done := FALSE;
-
- WHILE( I <= L ) AND ( NOT Done ) DO
- BEGIN
-
- FK_Char := Key_Text[I];
-
- IF FK_Char = FK_CR THEN
- Async_Send( CHR( CR ) )
-
- ELSE IF FK_Char = FK_Delay THEN
- DELAY( One_Second_Delay )
-
- ELSE IF FK_Char = FK_Wait_For THEN
- BEGIN (* Wait For *)
-
- I := I + 1;
-
- IF ( I <= L ) THEN
- BEGIN
- WaitString_Mode := TRUE;
- Really_Wait_String := TRUE;
- Script_Wait_Text := Key_Text[I];
- Script_Wait_Time := 60;
- Script_Wait_Failure := 0;
- Script_Wait_Start := TimeOfDay;
- I := I + 1;
- IF ( I <= L ) THEN
- Script_Wait_Reply_Text := COPY( Key_Text, I, L - I + 1 )
- ELSE
- Script_Wait_Reply_Text := '';
- Done := TRUE;
- END;
-
- END
- ELSE
- Async_Send( Key_Text[I] );
-
- I := I + 1;
-
- END;
-
- END (* Send_Function_Key *);